import Vue from 'vue'
import Vuex from 'vuex'
import xieyi from './modules/xieyi'
import persisted from "vuex-persistedstate";
import user from './modules/user'
import form from './modules/form'

Vue.use(Vuex)

export default new Vuex.Store({
    plugins: [persisted()],
    state: {
        //loadding
        isShow: false,
        //判断是否登录
        isLogin: false,
        //ocr识别的结果
        ocrForm: {},
        //ocr照片的url
        ocrUrl: {},
        //我的订单上面的状态
        count: 1,
        // 订单的状态
        status: '',
        //获取订单还款计划
        orderInfo: {},
        //获取订单id
        orderId: '',
    },
    getters: {},
    mutations: {
        //改变订单id
        changeOrderId(state, payload) {
            state.orderId = payload
        },
        //改变订单还款计划
        changeOrderInfo(state, payload) {
            state.orderInfo = payload
        },
        //改变订单顶部的状态
        changeStatus(state, payload) {
            state.status = payload
        },
        //改变count
        changeCount(state, payload) {
            state.count = payload
        },
        setOCRUrl(state, payload) {
            state.ocrUrl = payload
        },
        // 展示loadding方法
        showLoading(state) {
            state.isShow = true
        },
        // 影藏loadding方法
        hideLoading(state) {
            state.isShow = false
        },
        //登录
        changeLogin(state) {
            state.isLogin = true
        },
        //退出
        logout(state) {
            state.isLogin = false
        },
        setocrForm(state, payload) {
            state.ocrForm = payload
        }
    },
    actions: {},
    modules: {
        xieyi,
        user,
        form,
    }
})